package com.wyx.springvueadmin.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private int code;
    private String message;
    private T data;

    public static <T> Result<T> success(T data){
        return new Result<>(1,"success",data);
    }

    public static <T> Result<T> success(){
        Result<T> result=new Result<>();
        result.code=1;
        result.message="success";
        return result;
    }

    public static <T> Result<T> err(){
        Result<T> result=new Result<>();
        result.code=0;
        result.message="error";
        return result;
    }

}
